.class public Lrexsee/ebook/DrawableLine;
.super Ljava/lang/Object;
.source "DrawableLine.java"

# interfaces
.implements Lrexsee/ebook/LineInterface;


# instance fields
.field private final mDrawable:Landroid/graphics/drawable/Drawable;

.field private final mRect:Landroid/graphics/Rect;


# direct methods
.method public constructor <init>(Landroid/graphics/drawable/Drawable;IIII)V
    .locals 1
    .param p1, "drawable"    # Landroid/graphics/drawable/Drawable;
    .param p2, "width"    # I
    .param p3, "height"    # I
    .param p4, "maxWidth"    # I
    .param p5, "maxHeight"    # I

    .prologue
    .line 10
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 11
    iput-object p1, p0, Lrexsee/ebook/DrawableLine;->mDrawable:Landroid/graphics/drawable/Drawable;

    .line 12
    invoke-static {p1, p2, p3, p4, p5}, Lrexsee/ebook/DrawableLine;->getScaledImageRect(Landroid/graphics/drawable/Drawable;IIII)Landroid/graphics/Rect;

    move-result-object v0

    iput-object v0, p0, Lrexsee/ebook/DrawableLine;->mRect:Landroid/graphics/Rect;

    .line 13
    return-void
.end method

.method public static getScaledImageRect(Landroid/graphics/drawable/Drawable;II)Landroid/graphics/Rect;
    .locals 7
    .param p0, "imageDrawable"    # Landroid/graphics/drawable/Drawable;
    .param p1, "maxWidth"    # I
    .param p2, "maxHeight"    # I

    .prologue
    const/4 v6, 0x0

    .line 35
    invoke-virtual {p0}, Landroid/graphics/drawable/Drawable;->getIntrinsicWidth()I

    move-result v1

    .line 36
    .local v1, "imageWidth":I
    invoke-virtual {p0}, Landroid/graphics/drawable/Drawable;->getIntrinsicHeight()I

    move-result v0

    .line 37
    .local v0, "imageHeight":I
    if-gez v1, :cond_0

    if-gez v0, :cond_0

    .line 38
    new-instance v3, Landroid/graphics/Rect;

    invoke-direct {v3, v6, v6, p1, p2}, Landroid/graphics/Rect;-><init>(IIII)V

    .line 44
    :goto_0
    return-object v3

    .line 40
    :cond_0
    int-to-float v3, v1

    int-to-float v4, p1

    div-float/2addr v3, v4

    int-to-float v4, v0

    int-to-float v5, p2

    div-float/2addr v4, v5

    invoke-static {v3, v4}, Ljava/lang/Math;->max(FF)F

    move-result v2

    .line 41
    .local v2, "scale":F
    const/high16 v3, 0x3f800000    # 1.0f

    cmpl-float v3, v2, v3

    if-lez v3, :cond_1

    .line 42
    new-instance v3, Landroid/graphics/Rect;

    int-to-float v4, v1

    div-float/2addr v4, v2

    invoke-static {v4}, Ljava/lang/Math;->round(F)I

    move-result v4

    int-to-float v5, v0

    div-float/2addr v5, v2

    invoke-static {v5}, Ljava/lang/Math;->round(F)I

    move-result v5

    invoke-direct {v3, v6, v6, v4, v5}, Landroid/graphics/Rect;-><init>(IIII)V

    goto :goto_0

    .line 44
    :cond_1
    new-instance v3, Landroid/graphics/Rect;

    invoke-direct {v3, v6, v6, v1, v0}, Landroid/graphics/Rect;-><init>(IIII)V

    goto :goto_0
.end method

.method public static getScaledImageRect(Landroid/graphics/drawable/Drawable;IIII)Landroid/graphics/Rect;
    .locals 5
    .param p0, "imageDrawable"    # Landroid/graphics/drawable/Drawable;
    .param p1, "targetWidth"    # I
    .param p2, "targetHeight"    # I
    .param p3, "maxWidth"    # I
    .param p4, "maxHeight"    # I

    .prologue
    const/4 v4, 0x0

    .line 49
    if-gez p1, :cond_0

    if-gez p2, :cond_0

    .line 50
    invoke-static {p0, p3, p4}, Lrexsee/ebook/DrawableLine;->getScaledImageRect(Landroid/graphics/drawable/Drawable;II)Landroid/graphics/Rect;

    move-result-object v1

    .line 60
    :goto_0
    return-object v1

    .line 51
    :cond_0
    if-gez p1, :cond_1

    .line 52
    invoke-static {p2, p4}, Ljava/lang/Math;->min(II)I

    move-result v1

    invoke-static {p0, p3, v1}, Lrexsee/ebook/DrawableLine;->getScaledImageRect(Landroid/graphics/drawable/Drawable;II)Landroid/graphics/Rect;

    move-result-object v1

    goto :goto_0

    .line 53
    :cond_1
    if-gez p2, :cond_2

    .line 54
    invoke-static {p1, p3}, Ljava/lang/Math;->min(II)I

    move-result v1

    invoke-static {p0, v1, p4}, Lrexsee/ebook/DrawableLine;->getScaledImageRect(Landroid/graphics/drawable/Drawable;II)Landroid/graphics/Rect;

    move-result-object v1

    goto :goto_0

    .line 56
    :cond_2
    int-to-float v1, p1

    int-to-float v2, p3

    div-float/2addr v1, v2

    int-to-float v2, p2

    int-to-float v3, p4

    div-float/2addr v2, v3

    invoke-static {v1, v2}, Ljava/lang/Math;->max(FF)F

    move-result v0

    .line 57
    .local v0, "scale":F
    const/high16 v1, 0x3f800000    # 1.0f

    cmpl-float v1, v0, v1

    if-lez v1, :cond_3

    .line 58
    new-instance v1, Landroid/graphics/Rect;

    int-to-float v2, p1

    div-float/2addr v2, v0

    invoke-static {v2}, Ljava/lang/Math;->round(F)I

    move-result v2

    int-to-float v3, p2

    div-float/2addr v3, v0

    invoke-static {v3}, Ljava/lang/Math;->round(F)I

    move-result v3

    invoke-direct {v1, v4, v4, v2, v3}, Landroid/graphics/Rect;-><init>(IIII)V

    goto :goto_0

    .line 60
    :cond_3
    new-instance v1, Landroid/graphics/Rect;

    invoke-direct {v1, v4, v4, p1, p2}, Landroid/graphics/Rect;-><init>(IIII)V

    goto :goto_0
.end method


# virtual methods
.method public draw(Landroid/graphics/Canvas;Landroid/graphics/Rect;)V
    .locals 5
    .param p1, "canvas"    # Landroid/graphics/Canvas;
    .param p2, "rect"    # Landroid/graphics/Rect;

    .prologue
    .line 28
    invoke-virtual {p0}, Lrexsee/ebook/DrawableLine;->isNull()Z

    move-result v2

    if-eqz v2, :cond_0

    .line 33
    :goto_0
    return-void

    .line 29
    :cond_0
    iget v2, p2, Landroid/graphics/Rect;->left:I

    invoke-virtual {p2}, Landroid/graphics/Rect;->width()I

    move-result v3

    iget-object v4, p0, Lrexsee/ebook/DrawableLine;->mRect:Landroid/graphics/Rect;

    invoke-virtual {v4}, Landroid/graphics/Rect;->width()I

    move-result v4

    sub-int/2addr v3, v4

    div-int/lit8 v3, v3, 0x2

    add-int v0, v2, v3

    .line 30
    .local v0, "left":I
    iget v2, p2, Landroid/graphics/Rect;->top:I

    invoke-virtual {p2}, Landroid/graphics/Rect;->height()I

    move-result v3

    iget-object v4, p0, Lrexsee/ebook/DrawableLine;->mRect:Landroid/graphics/Rect;

    invoke-virtual {v4}, Landroid/graphics/Rect;->height()I

    move-result v4

    sub-int/2addr v3, v4

    div-int/lit8 v3, v3, 0x2

    add-int v1, v2, v3

    .line 31
    .local v1, "top":I
    iget-object v2, p0, Lrexsee/ebook/DrawableLine;->mDrawable:Landroid/graphics/drawable/Drawable;

    iget-object v3, p0, Lrexsee/ebook/DrawableLine;->mRect:Landroid/graphics/Rect;

    invoke-virtual {v3}, Landroid/graphics/Rect;->width()I

    move-result v3

    add-int/2addr v3, v0

    iget-object v4, p0, Lrexsee/ebook/DrawableLine;->mRect:Landroid/graphics/Rect;

    invoke-virtual {v4}, Landroid/graphics/Rect;->height()I

    move-result v4

    add-int/2addr v4, v1

    invoke-virtual {v2, v0, v1, v3, v4}, Landroid/graphics/drawable/Drawable;->setBounds(IIII)V

    .line 32
    iget-object v2, p0, Lrexsee/ebook/DrawableLine;->mDrawable:Landroid/graphics/drawable/Drawable;

    invoke-virtual {v2, p1}, Landroid/graphics/drawable/Drawable;->draw(Landroid/graphics/Canvas;)V

    goto :goto_0
.end method

.method public getHeight()I
    .locals 1

    .prologue
    .line 24
    iget-object v0, p0, Lrexsee/ebook/DrawableLine;->mRect:Landroid/graphics/Rect;

    invoke-virtual {v0}, Landroid/graphics/Rect;->height()I

    move-result v0

    return v0
.end method

.method public getIndexTitle()Ljava/lang/String;
    .locals 1

    .prologue
    .line 66
    const/4 v0, 0x0

    return-object v0
.end method

.method public getText()Ljava/lang/String;
    .locals 1

    .prologue
    .line 70
    const/4 v0, 0x0

    return-object v0
.end method

.method public isNull()Z
    .locals 1

    .prologue
    .line 16
    iget-object v0, p0, Lrexsee/ebook/DrawableLine;->mDrawable:Landroid/graphics/drawable/Drawable;

    if-nez v0, :cond_0

    const/4 v0, 0x1

    :goto_0
    return v0

    :cond_0
    const/4 v0, 0x0

    goto :goto_0
.end method

.method public isPageBreak()Z
    .locals 1

    .prologue
    .line 20
    const/4 v0, 0x0

    return v0
.end method
